<?php
declare (strict_types = 1);

namespace app\mall\model;

use app\mall\enum\ScoreEnum;
use app\mall\model\traits\GoodsTrait;
use app\mall\model\traits\StoreTrait;
use app\mall\model\traits\UserTrait;
use think\Model;

/**
 * @mixin Model
 * @property ScoreEnum score_enum
 */
class MallGoodsComment extends MallBase
{
    use UserTrait;
    use GoodsTrait;
    use StoreTrait;

    public function getScoreTextAttr($key, $data): string
    {
        return $this->score_enum->getZhName();
    }

    public function getScoreEvaluateAttr($key, $data): string
    {
        return $this->score_enum->getEvaluate();
    }

    public function getScoreEnumAttr($key, $data)
    {
        return new ScoreEnum($data['score']);
    }

}
